From: Jan Beulich Date: Wed, 14 Dec 2016 09:10:11 +0000 (+0100) Subject: x86emul: check for CLFLUSH{,OPT} availability X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~3150 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=4133077d06a14d041d68250e67eac4d7bcbabfcf;p=xen.git x86emul: check for CLFLUSH{,OPT} availability We can't exclude someone wanting to hide either of the instructions from guests. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 49ae96a0a3..43a6794a07 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1305,6 +1305,7 @@ static bool vcpu_has( #define vcpu_has_hle() vcpu_has( 7, EBX, 4, ctxt, ops) #define vcpu_has_rtm() vcpu_has( 7, EBX, 11, ctxt, ops) #define vcpu_has_smap() vcpu_has( 7, EBX, 20, ctxt, ops) +#define vcpu_has_clflushopt() vcpu_has( 7, EBX, 23, ctxt, ops) #define vcpu_must_have(feat) \ generate_exception_if(!vcpu_has_##feat(), EXC_UD) @@ -5187,6 +5188,10 @@ x86_emulate( { case 7: /* clflush{,opt} */ fail_if(modrm_mod == 3); + if ( !vex.pfx ) + vcpu_must_have(clflush); + else + vcpu_must_have(clflushopt); fail_if(ops->wbinvd == NULL); if ( (rc = ops->wbinvd(ctxt)) != 0 ) goto done;